<?php

namespace app\controller\open;

use app\validate\P2pUpgradeSelectorValidate;
use app\service\P2pUpgradeService;
use share\utils\Helper;
use think\response\Xml;

class P2pUpgradeController extends BaseOpenController{

    protected $beforeActionList = [
    ];

    public function initValidate(){        
        $this->validate = new P2pUpgradeSelectorValidate();
    }

    public function get_conf_action(){
        $input = $this->check('check');   
        $dn = isset($input['dn']) ? $input['dn'] : '';
        $sn = isset($input['sn']) ? $input['sn'] : '';
        $pk = isset($input['pk']) ? $input['pk'] : '';
        $data = P2pUpgradeService::getConfByFilter($dn,$sn,$pk);
        $res = Helper::arrayUnderscoreToCamelKey($data);
        if(isset($res['endSpan'])){
            $res['stopSpan'] = $res['endSpan'];
            unset($res['endSpan']);
        }
        // $resp = [
        //         'resultCode' => 0 ,
        //         'errorString' => "success",
        //         'body' => $res,
        // ];
        // // 返回XML
        // return new Xml($resp,200,[],['root_node' => 'response']);

        return self::ok($res); 
    }
}